import { createWebHistory, createRouter } from "vue-router";
import Layout from "@/layout";

/**
 * Note: 路由配置项
 *
 * hidden: true                     // 当设置 true 的时候该路由不会再侧边栏出现 如401，login等页面，或者如一些编辑页面/edit/1
 * alwaysShow: true                 // 当你一个路由下面的 children 声明的路由大于1个时，自动会变成嵌套的模式--如组件页面
 *                                  // 只有一个时，会将那个子路由当做根路由显示在侧边栏--如引导页面
 *                                  // 若你想不管路由下面的 children 声明的个数都显示你的根路由
 *                                  // 你可以设置 alwaysShow: true，这样它就会忽略之前定义的规则，一直显示根路由
 * redirect: noRedirect             // 当设置 noRedirect 的时候该路由在面包屑导航中不可被点击
 * name:'router-name'               // 设定路由的名字，一定要填写不然使用<keep-alive>时会出现各种问题
 * query: '{"id": 1, "name": "ry"}' // 访问路由的默认传递参数
 * meta : {
    noCache: true                   // 如果设置为true，则不会被 <keep-alive> 缓存(默认 false)
    title: 'title'                  // 设置该路由在侧边栏和面包屑中展示的名字
    icon: 'svg-name'                // 设置该路由的图标，对应路径src/assets/icons/svg
    breadcrumb: false               // 如果设置为false，则不会在breadcrumb面包屑中显示
    activeMenu: '/system/user'      // 当路由设置了该属性，则会高亮相对应的侧边栏。
  }
 */

// 公共路由
export const constantRoutes = [
  {
    path: "/redirect",
    component: Layout,
    hidden: true,
    children: [
      {
        path: "/redirect/:path(.*)",
        component: () => import("@/views/redirect/index.vue"),
      },
    ],
  },
  {
    path: "/login",
    component: () => import("@/views/login"),
    hidden: true,
  },
  {
    path: "/register",
    component: () => import("@/views/register"),
    hidden: true,
  },
  {
    path: "/:pathMatch(.*)*",
    component: () => import("@/views/error/404"),
    hidden: true,
  },
  {
    path: "/401",
    component: () => import("@/views/error/401"),
    hidden: true,
  },
  {
    path: "/",
    component: Layout,
    redirect: "/taskM/taskManage",
  },
  {
    path: "/user",
    component: Layout,
    hidden: true,
    redirect: "noredirect",
    children: [
      {
        path: "profile",
        component: () => import("@/views/system/user/profile/index"),
        name: "Profile",
        meta: { title: "个人中心", icon: "user" },
      },
    ],
  },
  {
    path: "/system/user-auth",
    component: Layout,
    hidden: true,
    children: [
      {
        path: "role/:userId(\\d+)",
        component: () => import("@/views/system/user/authRole"),
        name: "AuthRole",
        meta: { title: "分配角色", activeMenu: "/system/user" },
      },
    ],
  },
  {
    path: "/system/role-auth",
    component: Layout,
    hidden: true,
    children: [
      {
        path: "user/:roleId(\\d+)",
        component: () => import("@/views/system/role/authUser"),
        name: "AuthUser",
        meta: { title: "分配用户", activeMenu: "/system/role" },
      },
    ],
  },
  {
    path: "/system/dict-data",
    component: Layout,
    hidden: true,
    children: [
      {
        path: "index/:dictId(\\d+)",
        component: () => import("@/views/system/dict/data"),
        name: "Data",
        meta: { title: "字典数据", activeMenu: "/system/dict" },
      },
    ],
  },
  {
    path: "/monitor/job-log",
    component: Layout,
    hidden: true,
    children: [
      {
        path: "index",
        component: () => import("@/views/monitor/job/log"),
        name: "JobLog",
        meta: { title: "调度日志", activeMenu: "/monitor/job" },
      },
    ],
  },
  {
    path: "/tool/gen-edit",
    component: Layout,
    hidden: true,
    children: [
      {
        path: "index/:tableId(\\d+)",
        component: () => import("@/views/tool/gen/editTable"),
        name: "GenEdit",
        meta: { title: "修改生成配置", activeMenu: "/tool/gen" },
      },
    ],
  },
  {
    path: "/dataManage",
    component: Layout,
    hidden: true,
    redirect: "noRedirect",
    meta: { title: "数据管理", icon: "dataManage" },
    children: [
    	{
        path: "landslipSurvey",
        component: () => import("@/views/dataManage/landslipSurvey/index"),
        name: "landslipSurvey",
        meta: { title: "滑坡现场调查数据", icon: "landslipSurvey" },
      },
      {
        path: "drillHoleData",
        component: () => import("@/views/dataManage/drillHoleData/index"),
        name: "drillHoleData",
        meta: { title: "钻孔数据管理", icon: "drillHoleData" },
      },
      
      {
        path: "climateData",
        component: () => import("@/views/dataManage/climateData/index"),
        name: "climateData",
        meta: { title: "气候数据", icon: "climateData" },
      },

      {
        path: "demData",
        component: () => import("@/views/dataManage/demData/index"),
        name: "demData",
        meta: { noCache: true, title: "地形地貌数据", icon: "demData" },
      },
      {
        path: "faultData",
        component: () => import("@/views/dataManage/faultData/index"),
        name: "faultData",
        meta: { noCache: true, title: "活断层数据", icon: "faultData" },
      },
      {
        path: "roadData",
        component: () => import("@/views/dataManage/roadData/index"),
        name: "roadData",
        meta: { noCache: true, title: "道路数据", icon: "roadData" },
      },
      {
        path: "riverData",
        component: () => import("@/views/dataManage/riverData/index"),
        name: "riverData",
        meta: { noCache: true, title: "水系数据", icon: "riverData" },
      },
      {
        path: "dcyxData",
        component: () => import("@/views/dataManage/dcyxData/index"),
        name: "dcyxData",
        meta: { noCache: true, title: "地层岩性数据", icon: "dcyxData" },
      },
      {
        path: "pgaData",
        component: () => import("@/views/dataManage/pgaData/index"),
        name: "pgaData",
        meta: { noCache: true, title: "地震动峰值加速度数据", icon: "pgaData" },
      },
      {
        path: "hpygyxjyData",
        component: () => import("@/views/dataManage/hpygyxjyData/index"),
        name: "hpygyxjyData",
        meta: { noCache: true, title: "滑坡遥感影像解译数据", icon: "hpygyxjyData" },
      },
      {
        path: "landformData",
        component: () => import("@/views/dataManage/landformData/index"),
        name: "landformData",
        meta: { noCache: true, title: "地貌数据", icon: "landformData" },
      },
      {
        path: "trmdData",
        component: () => import("@/views/dataManage/trmdData/index"),
        name: "trmdData",
        meta: { noCache: true, title: "天然密度数据", icon: "trmdData" },
      },
      {
        path: "dzgzData",
        component: () => import("@/views/dataManage/dzgzData/index"),
        name: "dzgzData",
        meta: { noCache: true, title: "地震构造数据", icon: "dzgzData" },
      },
    ],
  },
  {
    path: "/landslipSurvey",
    component: Layout,
    hidden: true,
    redirect: "/landslipSurvey/dataView",
    children: [
      {
        path: "/landslipSurvey/dataView",
        component: () => import("@/views/dataManage/landslipSurvey/dataView"),
        name: "dataView",
        meta: { title: "数据查看" },
      },
    ],
  },
{
  path: "/taskM",
  component: Layout,
  hidden: true,
  redirect: "noRedirect",
  children: [
    {
      path: "taskManage",
      component: () => import("@/views/taskManage/index"),
      name: "taskManage",
      meta: { title: "任务管理", icon: "taskManage" },
    },
  ],
},
{
  path: "/slideAssess",
  component: Layout,
  hidden: true,
  redirect: "noRedirect",
  children: [
    {
      path: "distributionPatternAnalysis",
      component: () => import("@/views/slideAssess/distributionPatternAnalysis/main"),
      name: "distributionPatternAnalysis",
      meta: {title: "分布规律分析", icon: "distributionPatternAnalysis"},
      children: [
        {
          path: "earthquakeIntensityRelation",
          component: () => import("@/views/slideAssess/distributionPatternAnalysis/earthquakeIntensityRelation/index"),
          name: "earthquakeIntensityRelation",
          meta: {title: "与地震烈度的关系", icon: "earthquakeIntensityRelation", noCache: true},
        },
        {
          path: "seismogenicFaultDistanceRelation",
          component: () => import("@/views/slideAssess/distributionPatternAnalysis/seismogenicFaultDistanceRelation/index"),
          name: "seismogenicFaultDistanceRelation",
          meta: {title: "与距断层距离的关系", icon: "seismogenicFaultDistanceRelation", noCache: true},
        },
        {
          path: "elevationRelation",
          component: () => import("@/views/slideAssess/distributionPatternAnalysis/elevationRelation/index"),
          name: "elevationRelation",
          meta: {title: "与高程的关系", icon: "elevationRelation", noCache: true},
        },
        {
          path: "terrainSlopeRelation",
          component: () => import("@/views/slideAssess/distributionPatternAnalysis/terrainSlopeRelation/index"),
          name: "terrainSlopeRelation",
          meta: {title: "与地形坡度的关系", icon: "terrainSlopeRelation", noCache: true},
        },
        {
          path: "slopeAspectRelation",
          component: () => import("@/views/slideAssess/distributionPatternAnalysis/slopeAspectRelation/index"),
          name: "slopeAspectRelation",
          meta: {title: "与坡向的关系", icon: "slopeAspectRelation", noCache: true},
        },
        {
          path: "riverSystemRelation",
          component: () => import("@/views/slideAssess/distributionPatternAnalysis/riverSystemRelation/index"),
          name: "riverSystemRelation",
          meta: {title: "与水系的关系", icon: "riverSystemRelation", noCache: true},
        },
        {
          path: "stratumLithologyRelation",
          component: () => import("@/views/slideAssess/distributionPatternAnalysis/stratumLithologyRelation/index"),
          name: "stratumLithologyRelation",
          meta: {title: "与地层岩性的关系", icon: "stratumLithologyRelation", noCache: true},
        },
      ]
    },

    {
      path: "analysisAssess",
      component: () => import("@/views/slideAssess/analysisAssess/index"),
      name: "analysisAssess",
      meta: { title: "分析评估", icon: "analysisAssess" },
    },
    
  ],
},
{
  path: "/analysisAssess",
  component: Layout,
  hidden: true,
  redirect: "/analysisAssess/indexModelMapSelect",
  children: [
    {
      path: "/analysisAssess/indexModelMapSelect",
      component: () => import("@/views/slideAssess/analysisAssess/indexModelMapSelect"),
      name: "indexModelMapSelect",
      meta: { noCache: true, title: "指数模型地图查看" },
    },
  ],
},
{
    path: "/analysisAssess",
    component: Layout,
    hidden: true,
    redirect: "/analysisAssess/levelAnalyse",
    children: [
      {
        path: "/analysisAssess/levelAnalyse",
        component: () => import("@/views/slideAssess/analysisAssess/levelAnalyse"),
        name: "levelAnalyse",
        meta: { title: "层次分析法模型", noCache: true },
      },
      {
        path: "/analysisAssess/levelAnalyseForm",
        component: () => import("@/views/slideAssess/analysisAssess/levelAnalyseForm"),
        name: "levelAnalyseForm",
        meta: { title: "修改页面", noCache: true },
      },
    ],
  },
  {
    path: "/analysisAssess",
    component: Layout,
    hidden: true,
    redirect: "/analysisAssess/logisti",
    children: [
      {
        path: "/analysisAssess/logisti",
        component: () => import("@/views/slideAssess/analysisAssess/logisti"),
        name: "logisti",
        meta: { title: "逻辑斯蒂模型", noCache: true },
      },
      {
        path: "/analysisAssess/logistiForm",
        component: () => import("@/views/slideAssess/analysisAssess/logistiForm"),
        name: "logistiForm",
        meta: { title: "修改页面", noCache: true },
      },
    ],
  },
  {
    path: "/analysisAssess",
    component: Layout,
    hidden: true,
    redirect: "/analysisAssess/indexModel",
    children: [
      {
        path: "/analysisAssess/indexModel",
        component: () => import("@/views/slideAssess/analysisAssess/indexModel"),
        name: "indexModel",
        meta: { title: "指数模型", noCache: true },
      },
    ],
  },
  {
    path: "/analysisAssess",
    component: Layout,
    hidden: true,
    redirect: "/analysisAssess/loessPlateau",
    children: [
      {
        path: "/analysisAssess/loessPlateau",
        component: () => import("@/views/slideAssess/analysisAssess/loessPlateau"),
        name: "loessPlateau",
        meta: { title: "黄土高原模型", noCache: true },
      },
      {
        path: "/analysisAssess/loessPlateauForm",
        component: () => import("@/views/slideAssess/analysisAssess/loessPlateauForm"),
        name: "loessPlateauForm",
        meta: { title: "修改页面", noCache: true },
      },
    ],
  },
  {
    path: "/analysisAssess",
    component: Layout,
    hidden: true,
    redirect: "/analysisAssess/newMark",
    children: [
      {
        path: "/analysisAssess/newMark",
        component: () => import("@/views/slideAssess/analysisAssess/newMark"),
        name: "newMark",
        meta: { title: "Newmark模型", noCache: true },
      },
      {
        path: "/analysisAssess/newMarkForm",
        component: () => import("@/views/slideAssess/analysisAssess/newMarkForm"),
        name: "newMarkForm",
        meta: { title: "修改页面", noCache: true },
      },
    ],
  },
  {
	  path: "/sandliquidAssess",
	  component: Layout,
	  hidden: true,
	  redirect: "noRedirect",
	  children: [	
	    {
	      path: "stAnalysisAssess",
	      component: () => import("@/views/sandliquidAssess/stAnalysisAssess/index"),
	      name: "stAnalysisAssess",
	      meta: { title: "分析评估", icon: "stAnalysisAssess", noCache: true },
	    },	    
	  ],
	},
	{
    path: "/stAnalysisAssess",
    component: Layout,
    hidden: true,
    redirect: "/stAnalysisAssess/indexAssess1",
    children: [
      {
        path: "/stAnalysisAssess/indexAssess1",
        component: () => import("@/views/sandliquidAssess/stAnalysisAssess/indexAssess1"),
        name: "indexAssess1",
        meta: { title: "评估页面", noCache: true },
      },
      {
        path: "/stAnalysisAssess/indexAssess1Form",
        component: () => import("@/views/sandliquidAssess/stAnalysisAssess/indexAssess1Form"),
        name: "indexAssess1Form",
        meta: { title: "修改页面", noCache: true },
      },
    ],
  },
  {
    path: "/stAnalysisAssess",
    component: Layout,
    hidden: true,
    redirect: "/stAnalysisAssess/indexAssess2",
    children: [
      {
        path: "/stAnalysisAssess/indexAssess2",
        component: () => import("@/views/sandliquidAssess/stAnalysisAssess/indexAssess2"),
        name: "indexAssess2",
        meta: { title: "评估页面", noCache: true },
      },
      {
        path: "/stAnalysisAssess/indexAssess2Form",
        component: () => import("@/views/sandliquidAssess/stAnalysisAssess/indexAssess2Form"),
        name: "indexAssess2Form",
        meta: { title: "修改页面", noCache: true },
      },
    ],
  },
  {
    path: "/stAnalysisAssess",
    component: Layout,
    hidden: true,
    redirect: "/stAnalysisAssess/indexAssess3",
    children: [
      {
        path: "/stAnalysisAssess/indexAssess3",
        component: () => import("@/views/sandliquidAssess/stAnalysisAssess/indexAssess3"),
        name: "indexAssess3",
        meta: { title: "评估页面", noCache: true },
      },
      {
        path: "/stAnalysisAssess/indexAssess3Form",
        component: () => import("@/views/sandliquidAssess/stAnalysisAssess/indexAssess3Form"),
        name: "indexAssess3Form",
        meta: { title: "修改页面", noCache: true },
      },
    ],
  },
  {
    path: "/stAnalysisAssess",
    component: Layout,
    hidden: true,
    redirect: "/stAnalysisAssess/indexModelMapSelect",
    children: [
      {
        path: "/stAnalysisAssess/indexModelMapSelect",
        component: () => import("@/views/sandliquidAssess/stAnalysisAssess/indexModelMapSelect"),
        name: "indexModelMap",
        meta: { noCache: true, title: "地图查看结果" },
      },
    ],
  },
  {
	  path: "/weakSoilAssess",
	  component: Layout,
	  hidden: true,
	  redirect: "noRedirect",
	  children: [
	    {
	      path: "rtAnalysisAssess",
	      component: () => import("@/views/weakSoilAssess/rtAnalysisAssess/index"),
	      name: "rtAnalysisAssess",
	      meta: { title: "分析评估", icon: "rtAnalysisAssess", noCache: true },
	    },
      {
        path: "/rtAnalysisAssess/indexAssessForm",
        component: () => import("@/views/weakSoilAssess/rtAnalysisAssess/indexAssessForm"),
        name: "indexAssessForm",
        meta: { title: "修改页面", noCache: true },
      },
	  ],
	},
	{
    path: "/rtAnalysisAssess",
    component: Layout,
    hidden: true,
    redirect: "/rtAnalysisAssess/indexAssess",
    children: [
      {
        path: "/rtAnalysisAssess/indexAssess",
        component: () => import("@/views/weakSoilAssess/rtAnalysisAssess/indexAssess"),
        name: "indexAssess",
        meta: { title: "评估页面", noCache: true }
      },
      {
        path: "/rtAnalysisAssess/indexAssess/indexAssessMap",
        component: () => import("@/views/weakSoilAssess/rtAnalysisAssess/indexAssessMap"),
        name: "indexAssessMap",
        meta: { title: "区域评估结果" }
      }
    ],
  },
{
  path: "/ruptureZone",
  component: Layout,
  hidden: true,
  redirect: "noRedirect",
  children: [
    {
      path: "ruptureZoneAssess",
      component: () => import("@/views/ruptureZoneAssess/index"),
      name: "ruptureZoneAssess",
      meta: { title: "地表破裂带评估", icon: "ruptureZoneAssess" },
    },
    {
      path: "parameterSettings",
      component: () => import("@/views/parameterSettings/index"),
      name: "parameterSettings",
      meta: { title: "参数设置", icon: "parameterSettings" },
    },
    {
      path: "ruptureZoneAssessDetailMap",
      component: () => import("@/views/ruptureZoneAssess/detail/index"),
      name: "ruptureZoneAssessDetailMap",
      meta: { title: "查看地表破裂带评估结果" }
    }
  ],
},
{
  path: "/resultManage",
  component: Layout,
  hidden: true,
  redirect: "noRedirect",
  meta: { title: "成果管理", icon: "resultManage" },
  children: [
    {
      path: "chartManger",
      component: () => import("@/views/resultManage/chartManger/index"),
      name: "chartManger",
      meta: { title: "图件管理", icon: "chartManger" },
    },
    {
      path: "reportManger",
      component: () => import("@/views/resultManage/reportManger/index"),
      name: "reportManger",
      meta: { title: "报告管理", icon: "reportManger" },
    },
    {
      path: "reportReview",
      component: () => import("@/views/resultManage/reportReview/index"),
      name: "reportReview",
      meta: { title: "报告审核", icon: "reportReview" },
    },
    {
      path: "templateModule",
      component: () => import("@/views/resultManage/templateModule/index"),
      name: "templateModule",
      meta: { title: "图件模板管理", icon: "templateModule" },
    },
  ],
},
{
  path: "/screenData",
  component: Layout,
  hidden: true,
  redirect: "noRedirect",
  meta: {title: "大屏关联数据管理", icon: "screenData"},
  children: [
    {
      path: "index2",
      component: () => import("@/views/screenData/index"),
      name: "reportModelManage",
      meta: { title: "大屏关联数据管理", icon: "index2",noCache: true },
    },
  ],
}
//{
//  path: "/operating",
//  component: Layout,
//  redirect: "noRedirect",
//  children: [
//    {
//      path: "operatingRecord",
//      component: () => import("@/views/operatingRecord/index"),
//      name: "operatingRecord",
//      meta: { title: "操作记录", icon: "operatingRecord" ,noCache: true },
//    },
//  ],
//},

];

const router = createRouter({
  history: createWebHistory("dzzh"),
  routes: constantRoutes,
  scrollBehavior (to, from, savedPosition) {
    if (savedPosition) {
      return savedPosition;
    } else {
      return { top: 0 };
    }
  },
});

export default router;
